package com.zkq.life;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor;
import org.springframework.stereotype.Component;

/**
 * @author zhangkakaiqiang
 * @version 1.0.0
 * @Description TODO
 * @createTime 2022-01-17
 */
@Component
public class Dog implements InstantiationAwareBeanPostProcessor {

    private String name;

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        if (bean instanceof Dog) {
            Dog dog = (Dog) bean;
            dog.setName("wang wang");
            System.out.println("InstantiationAwareBeanPostProcessor ------> " + dog.getName());
        }
        return bean;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
